﻿using Prism.Regions;
using System.Windows;
using System.Windows.Controls;
using Prism.Ioc;

namespace PrismModule.MS.EditDrugs.Views
{
    /// <summary>
    /// Interaction logic for PUC_DialogEditDrug
    /// </summary>
    public partial class PUC_DialogEditDrug : UserControl
    {
        public PUC_DialogEditDrug()
        {
            InitializeComponent();
            // 设置全屏
            //this.WindowState = System.Windows.WindowState.Normal;
            //this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            double x = SystemParameters.WorkArea.Width;//得到屏幕工作区域宽度
            double y = SystemParameters.WorkArea.Height;//得到屏幕工作区域高度

            this.Width = x;
            this.Height = y;
            var _regionManager = ContainerLocator.Current.Resolve<IRegionManager>();
            if (_regionManager != null)
            {
                SetRegionManager(_regionManager, this.EditDrugControlRegion, "EditDrugContentRegion");
                //SetRegionManager(_regionManager, this.rightWindowCommandsRegion, RegionNames.ShowSearchPatientRegion);
            }
        }

        private void SetRegionManager(IRegionManager regionManager, DependencyObject regionTarget, string regionName)
        {
            RegionManager.SetRegionName(regionTarget, regionName);
            RegionManager.SetRegionManager(regionTarget, regionManager);
        }
    }
}